package com.dm.library.http.base;

/**
 * 版 权: 深圳市迪蒙网络科技有限公司
 * 描 述: 服务端返回的json格式
 * 修 改 人: sushuo
 * 修改时间: 2016-12-21
 */

public class JsonResult<T> {

    private static final String RESULT_OK = "000000";

    private String code;
    private String description;
    private T object;

    public JsonResult(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public JsonResult(String code, String description, T object) {
        this.code = code;
        this.description = description;
        this.object = object;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public T getObject() {
        return object;
    }

    public void setObject(T object) {
        this.object = object;
    }

    @Override
    public String toString() {
        return "JsonResult{" +
                "code='" + code + '\'' +
                ", description='" + description + '\'' +
                ", object=" + object +
                '}';
    }

    /**
     * 请求数据OK
     *
     * @return
     */
    public boolean isReqDataSuccess() {
        // 每次回来后通知消息到达
        return RESULT_OK.equals(code);
    }

}
